package rocksea.com.wechat

import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * Created by Mrw on 2018/2/2.
 *
 *
 */
class HttpCenter private constructor(){

    companion object {
        val instance: HttpCenter by lazy {
            HttpCenter() }
    }
    fun getMovieList(info:MainPrenster)
    {
        Observable.create<Any> {
            HttpImp.instance.requestPhotos(it)
        }
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe({
                    info.disMovieList(it.toString())
                }
                ,{
                    println(it.toString())
                    info.onError(it.toString())
                }
                ,{
                    println("完成")
                })
    }
}




